import { _decorator, Component, Label } from 'cc'
import { IPlayer } from '../Common'
const { ccclass } = _decorator

@ccclass('PlayerManager')
export class PlayerManager extends Component {
  init({ id, nickname, rid }: IPlayer) {
    const label = this.getComponent(Label)
    label.string = nickname + (rid ? ` (房间号${rid})` : '')
    this.node.active = true
  }
}
